
package testSVN;

import java.sql.Connection;
import java.sql.DriverManager; 
import java.sql.SQLException; 
import java.sql.Statement; 
import java.sql.ResultSet; 

public class Database_console {

    public static void main(String[] args) {
        
        try { 
            String host = "jdbc:oracle:thin:@localhost:1521:XE";
            String uName = "fyp"; 
            String uPass = "mypassword";
            Connection connection = DriverManager.getConnection(host, uName, uPass); 
            Statement statement = connection.createStatement(); 
            String SQL = "SELECT * FROM FYP.USERPLAYERACCOUNT";
            ResultSet rs = statement.executeQuery(SQL); 
            //rs.next(); // ResultSet Cursor pointing to just before first record, we move to the first row. 
            while(rs.next()) { 
                int id = rs.getInt("userID"); 
                String username = rs.getString("username"); 
                String password = rs.getString("password"); 
            
                System.out.println(id+" "+username+" "+password);
            }
        } catch (SQLException err) {
            
            System.out.println(err.getMessage()); 
        }
    }
}
